//
//  webCastHttpPlay.h
//  GenseeWebCastHttp
//
//  Created by apple on 14-3-13.
//  Copyright (c) 2014年 apple. All rights reserved.
//

#import <Foundation/Foundation.h>
#import<UIKit/UIKit.h>



typedef NS_ENUM(NSInteger, ResMsgType) {
    GS_ACTION_REC_MSG_CHAT = 0,      //聊天消息
    GS_ACTION_REC_MSG_CHAT_PRI ,     //私聊
    GS_ACTION_REC_MSG_DOC    ,      //文档
    GS_ACTION_REC_MSG_QA,           //问答
    GS_ACTION_REC_MSG_QUEST ,        //收到新问题
    GS_ACTION_REC_MSG_ANSWER,        //收到问题答案
    GS_ACTION_REC_MSG_VOTE,          //投票相关消息
    GS_ACTION_REC_MSG_VOTE_RESOULT,  //投票发布
    GS_ACTION_RES_MSG_LOTTERY,       //抽奖相关消息
    GS_ACTION_RES_MSG_TXTCAST,       //文字直播消息
    GS_ACTION_RES_MSG_CAST_STATUS,   //直播状态变更消息
    GS_ACTION_RES_MSG_SYS,           //gs系统消息
    GS_ACTION_RES_MSG_EJECTED,       //被踢消息
    GS_ACTION_RES_MSG_CAHT_FORBIDEN, //禁止聊天
    GS_ACTION_RES_MSG_USERCLIENT,    //允许升级
    GS_ACTION_RES_MSG_CAHT_UNFORBIDEN,// 允许聊天
    GS_ACTION_RES_MSG_QA_ENABLE   ,   //允许提问
    GS_ACTION_RES_MSG_ROLLCALL,       //点名
    GS_ACTION_RES_MSG_THIRD_VOTE,     //第三方投票
    GS_ACTION_RES_MSG_LAYOUT    ,     //布局
    GS_ACTION_RES_MSG_USR_NUM    ,        //用户数量
};

typedef NS_ENUM(NSInteger, UserStatus)
{
    USER_STATUS_DEFAULT          =  0x0000,
    USER_STATUS_HAVE_AUDIO       =  0x0001,
    USER_STATUS_HAVE_VIDEO       =  0x0002,
    USER_STATUS_OPEN_AUDIO       =  0x0004,
    USER_STATUS_OPEN_VIDEO       =  0x0008,
    USER_STATUS_MUTE_AUDIO       =  0x0010,
    USER_STATUS_MUTE_VIDEO       =  0x0020,
    USER_REQUEST_UPGRADE         =  0x0040,
    USER_STATUS_MUTE_CHAT        =  0x0080,
    USER_STATUS_FOCUS            =  0x0100,
    USER_STATUS_ROLLCALL_START   =  0x0200,
    USER_STATUS_ROLLCALL_RESULT  =  0x0400,
    
    WEB_AUDIO_INVITE             = 0x0800,
    WEB_AUDIO_CHATTING           = 0x1000,
};


typedef NS_ENUM(NSInteger, RollCallState)
{
    ROLLCALL_NOT_START          =  0x0000,
    ROLLCALL_STARTING           =  0x0400,
    ROLLCALL_PRESENT            =  0x0200,
    ROLLCALL_ABSENT             =  0x0600,
};

typedef enum
{
    WEBCAST_ROOM_NUMBER_UNEXIST = 0,            //直播间不存在
    WEBCAST_SUCCESS = 1,                        //登录成功
    WEBCAST_NOT_EXSITE = 2,                     //该点播的编号的点播不存在
    WEBCAST_FAIL_WEBCAST = 3,  	               //直播id不正确
    WEBCAST_FAIL_TOKEN = 4,    				   //口令错误
    WEBCAST_FAIL_LOGIN = 5,    			 	   //用户名或密码错误
    WEBCAST_WEBCAST_UNSTART = 6,			       //直播未开始
    WEBCAST_ISONLY_WEB = 7, 				       //只支持web
    WEBCAST_ROOM_UNEABLE = 8,			       //直播间不可用
    WEBCAST_OWNER_ERROR = 9,				       //内部问题
    WEBCAST_INVALID_ADDRESS = 10, 		 	   //无效地址
    WEBCAST_ROOM_OVERDUE = 11,                  //直播过期
    WEBCAST_AUTHORIZATION_NOT_ENOUGH = 12,      //授权不够
    WEBCAST_UNTIMELY = 13,                 	   //太早(还没到直播时间)
    WEBCAST_FAILED_NET_REQUIRED,                //网络请求失败
    WEBCAST_NET_RECONNECT   ,                   //短线重联
    WEBCAST_UNSURPORT_MOBILE = 18,              // 不支持移动设备
    
}WEBCAST_RESULT;

@protocol ReceiveCastDelegate;

@interface ReceiveCast : NSObject
@property(nonatomic,assign)id<ReceiveCastDelegate> delegate;
/*
 * @ carriedCtl  添加 音视频窗口的 viewcontroller
 * @ vFrame      音视频的frame
 * @ docFrame    文档viewFrame
 * @ domain      输入的域名
 * @ number      输入的会议编号
 * @ nicname     会议用的称呼
 * @ watchOrListen   true: 观看音视频    false:只收听音频
 * serviceType: 1.@"webcast"    2.@"training"    3.@"meeting"
 */
- (id)initWithGensee:(UIViewController*)carriedCtl
          videoFrame:(CGRect)vFrame
            docFrame:(CGRect)docFrame
              domain:(NSString *)domain
              number:(NSString *)number
             nicName:(NSString *)nicName
       watchOrListen:(BOOL)watchOrListen
           watchWord:(NSString*)watchWord
         serviceType:(NSString*)serviceType
            delegate:(id)delegate;

/*
 * 会议的登录
 */
- (void)login;

/*
 *  销毁 收听端的
 *
 */
- (void)destoryListen;


/* 发送聊天消息
 * @param msg
 * @param userid
 */
-(void)sendChatMsg:(NSString*)msg sUserid:(NSString*)userid;

/* 发送公聊信息
 * @param msg
 */

-(void)sendPublicMsg:(NSString*) msg;

/**
 * 提问
 * @param question
 */
- (void)sendQuest:(NSString*) question;

/**
 * 修改用户名
 * @param nikname
 */
- (void)alterNikName:(NSString*)newnikname;

/**
 * 问题应答，发送某个问题的答案
 * @param answer 答案
 */
- (void)answerQuestion:(NSString*) answer;

/**
 * 投票应答
 * @param o
 */
- (void) answerVote:(NSString* )vote commandId:(NSString*)commandId;
/**
 * 点名应答
 * @param o
 */
- (void)answerCallRoll:(RollCallState )CallRoll;

/*
 *feedBack :"0" 鼓掌 "1":反对  "2":太快  "3":太慢
 */

- (void)sendFeedBack:(NSString*)feedBack;


/**
 * 音视频切换
 * @param bool
 */
- (void)exchangeAVmode:(BOOL)avmode;

@end
@protocol ReceiveCastDelegate <NSObject>
@optional
/*
 *@msg :显示的的信息
 *@isSuccessed   true: 成功消息   false:失败消息
 *
 */

- (void)recLoginResoult:(WEBCAST_RESULT)resoultType;
/*
 *type :返回消息类型
 *msgInfo :消息内容
 */

- (void)sendBroadCast:(ResMsgType)type msgInfo:(NSDictionary*)msgInfo;




@end